//
//  ZBIteamCell.m
//  MoBan
//
//  Created by apple on 16/7/9.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "ZBIteamCell.h"
@interface ZBIteamCell()
@property(nonatomic,strong)UIImageView *imageview;
@property(nonatomic,strong)UILabel *lable;

/**
 此处应修改为模型
 */
@property(nonatomic,strong)NSString *molde;
@end
@implementation ZBIteamCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addUI];
    }
    return self;
}

/**
 添加UI
 */
-(void)addUI
{
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(ZbCelldidSelect)];
    
    [self addGestureRecognizer:tap];
    
    self.imageview = [[UIImageView alloc]init];
//    self.imageview.backgroundColor = [UIColor redColor];
    [self addSubview:self.imageview];
    
    self.lable = [[UILabel alloc]init];
    self.lable.textAlignment = NSTextAlignmentCenter;
    self.lable.font = [UIFont systemFontOfSize:12*Kscr];
    [self addSubview:self.lable];
    
    self.imageview.image = [UIImage imageNamed:@"text.png"];
    
    self.lable.text = @"测试数据";


}
-(void)layoutSubviews
{
    [super layoutSubviews];
    
    self.imageview.frame = CGRectMake(self.width/5, self.height/10, self.width*3/5, self.width*3/5);
    
    self.lable.frame = CGRectMake(0, self.imageview.bottom+self.height/10, self.width, self.height*9/10-self.imageview.bottom);
    
    NSLog(@"%f---%f",self.height,self.lable.bottom);

}
-(void)ZBSetDatasouce:(NSString *)str
{
    
    self.molde = str;
//    self.lable.text = str;
}
/**
 每一个iteam的点击
 */
-(void)ZbCelldidSelect
{

    if ([self.deleget respondsToSelector:@selector(ZBIteamCell:didSelected:)]) {
        [self.deleget ZBIteamCell:self didSelected:self.molde];
    }
}
@end
